package com.cn.test;

import java.util.Scanner;

/**
 * @author Li
 * @Date 2023/4/6 21:01
 */
public class NumberSplit {
    public static void main(String[] args) {
        /**
         * 输入一个三位数并将其拆分为个位，十位，百位，打印在控制台
         */
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入一个四位数！");
        int num = scanner.nextInt();
        int ge = num % 10;
        int shi = num / 10 % 10;
        int bai = num / 100 % 10;
        int qian = num / 1000 % 10;
        System.out.println("个位数为:"+ge);
        System.out.println("十位数为:"+shi);
        System.out.println("百位数为:"+bai);
        System.out.println("千位数为:"+qian);
    }

}
